#pragma once
#include <mysql/mysql.h>
#include <string>
#include <memory>

class DBConnection {
public:
    static DBConnection* getInstance();
    bool connect();
    void disconnect();
    MYSQL* getConnection() { return m_connection; }
    bool execute(const std::string& query);
    MYSQL_RES* query(const std::string& sql);
    std::string escapeString(const std::string& str);
    ~DBConnection();

private:
    static std::unique_ptr<DBConnection> m_instance;
    MYSQL* m_connection;

    DBConnection();
};
